package com.example.blog.config;


import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Component;

@Component
public class PublisherAware implements ApplicationEventPublisherAware {
    public ApplicationEventPublisher applicationEventPublisher;

    @Override
    public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
        this.applicationEventPublisher = applicationEventPublisher;
    }

    //自定义消息事件发布方法
    public void publisher(ApplicationEvent applicationEvent){
        applicationEventPublisher.publishEvent(applicationEvent);
    }


}
